package modelo.entidad;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="caracteristica",schema="public")
@PrimaryKeyJoinColumn(name="id")
public class Caracteristica implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	@Id
	@SequenceGenerator(name="SeqId", sequenceName="public.caracteristica_id_seq", allocationSize=1)	
	@GeneratedValue(generator="SeqId")
	private int id;
	
	@Column(name="nombre")
	private String nombre;
	
	@ManyToMany(cascade = {CascadeType.ALL},mappedBy="caracteristicas")
	private Set<Vehiculo> vehiculos = new HashSet();

	public Caracteristica() {
		super();
		// TODO Auto-generated constructor stub
	}

	public Caracteristica(String nombre) {
		super();
		this.nombre = nombre;
	}

	public int getId() {
		return id;
	}

	public String getNombre() {
		return nombre;
	}

	public void setId(int id) {
		this.id = id;
	}

	public void setNombre(String nombre) {
		this.nombre = nombre;
	}
	
	public Set<Vehiculo> getVehiculos() {
		return vehiculos;
	}

	public void setVehiculos(Set<Vehiculo> vehiculos) {
		this.vehiculos = vehiculos;
	}

}
